using System;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using Core;

namespace DataAccess
{
    public class tbOrg : Popular
    {

        public int OrgID { get; set; }
        public string NameOrg { get; set; }
        public int TypeOrg { get; set; }
        public string Description { get; set; }

        Common<tbOrg> cm = new Common<tbOrg>();
        public bool Insert(Popular b)
        {
            return cm.Insert(b as tbOrg, "sp_tbOrg_Insert");
        }
        public bool Update(Popular b)
        {
            return cm.UpDate(b as tbOrg, "sp_tbOrg_Update");
        }
        public bool Delete(object b)
        {
            return cm.Delete(b, "sp_tbOrg_Delete");
        }
        public IDataReader Select_ID(object b)
        {
            return cm.Select_ID(b, "sp_tbOrg_SelectByID");
        }
        public IDataReader Select_Name(object b)
        {
            return cm.Select_Name(b, "sp_tbOrg_SelectByName");
        }
        public IDataReader SelectAll()
        {
            return cm.Select_All("sp_tbOrg_SelectAll");
        }
        public List<tbOrg> SelectAllToList()
        {
            return cm.SelectAll<tbOrg>("sp_tbOrg_SelectAll");
        }
      
        public tbOrg GetOrgByMenu(object b)
        {
            return CBO.FillObject<tbOrg>(DataProvider.Instance.ExecuteReader("sp_tbOrg_SelectByMenuWeb", b));
        }
    }
}